<div class="col-md-3">
	<div class="row" id="sidebar">
		
		<div class="actions">
			<a href="#" title="" class="print"><?php echo translate("print"); ?></a>
			<a href="#" title="" class="mail"><?php echo ucfirst(translate("send_mail")); ?></a>
			<a href="#" title="" class="facebook-like">&nbsp;</a>
		</div>
		
		<div id="toCart">
			<h3><?php echo translate("shopping_cart");?></h3>
			<form class="form form-horizontal">
				<div class="form-group">
					<label class="control-label col-md-4"><?php echo ucfirst(translate("quantity"));?></label>
					<div class="control-group col-md-8">
						<input type="number" id="quantity" style="width:50px; float:left;" /> <div class="col-md-4"> <?php echo strtolower(($page["quantity_type"] == 1 ? translate("set") : translate("piece"))); ?></div>
					</div>
				</div>
				
				<div class="form-group">
					<label class="control-label col-md-4"><?php echo ucfirst(translate("transport"));?></label>
					<div class="control-group col-md-8">
						<select style="width:100%">
							<option value="0">Posta romana</option>
							<option value="1">FEDEX</option>
						</select>
						<span class="transportPrice"><?php echo translate("free_transport"); ?></span>
					</div>
				</div>
				
				<div class="form-group">
					<label class="control-label col-md-4"><?php echo ucfirst(translate("total_price"));?></label>
					<div class="control-group priceHolder col-md-8" >
						<?php echo $page["price"]; ?> X 1 + 0 RON =
						<br />
						<span class="productPrice text-right"><?php echo $page["price"]; ?></span>
					</div>
				</div>
				
				<button class="btn buyNow" stock_id="" product_id="<?php echo $page["id"]; ?>">
					<?php echo translate("buy_now"); ?>
				</button>
				
				<button class="btn addToCart" stock_id="" product_id="<?php echo $page["id"]; ?>">
					<?php echo translate("add_to_cart"); ?>
				</button>
				
				<div class="clearfix"></div>
				
				<div class="text-right wishlist">
					<?php if(!isset($client["wishlist"][$page["id"]])):?>
						<?php echo translate("or"); ?> <a href="#" title="" product_id="<?php echo $page["id"]; ?>" class="addToWishlist"><?php echo translate("add_to_wishlist"); ?></a>
					<?php else: ?>
						<?php echo translate("product_already_in_wishlist"); ?> <a href="#" title="" product_id="<?php echo $page["id"]; ?>" class="addToWishlist"><?php echo translate("remove_from_wishlist"); ?></a>
					<?php endif; ?>
					
				</div>
				
			</form>
		</div>
		
		<div class="paymentMethods text-right">
			<a title="">
				<img src="<?php echo scripts_url(); ?>img/payment-icons/paypal.jpg" alt="" />
			</a>
			<a title="">
				<img src="<?php echo scripts_url(); ?>img/payment-icons/visa.jpg" alt="" />
			</a>
			<a title="">
				<img src="<?php echo scripts_url(); ?>img/payment-icons/maestro.jpg" alt="" />
			</a>
		</div>
		<?php 
			$historyProducts = false;
			if($_SESSION["history"] && count($_SESSION["history"]) > 1)
			{
				$historyProducts = getProductByField($_SESSION["history"], "id");
				
				$slides = ceil(count($historyProducts)/3);
			} 
		?>
		<?php if($historyProducts):?>
			<div class="history">
				<h3><?php echo translate("product_history"); ?></h3>
				<div id="historyCarousel"  class="carousel slide" data-ride="carousel">
					<div class="carousel-inner">
					<?php
						$i = 0; $active = "active";
						
						for($i = 1; $i <= $slides; $i++)
						{
							$index = 0;
							?>
								<div class="item <?php echo $active; ?>">
									<?php foreach($historyProducts as $key => $product): ?>
										<a href="<?php echo $product["url"]?>" title="<?php echo $product["name"]; ?>">
											<img src="<?php echo scripts_url().$product["images"][0]["thumb_name"]; ?>" alt="" />
										</a>
									<?php
										$active = "";
										unset($historyProducts[$key]);
										if($index == 2) { break; } 
										$index++; 
										endforeach; ?>
								</div>
							<?php
						}
						?>
					</div>
					 <!-- Controls -->
					  <a class="left carousel-control" href="#historyCarousel" data-slide="prev">
					    <span class="glyphicon glyphicon-chevron-left"></span>
					  </a>
					  <a class="right carousel-control" href="#historyCarousel" data-slide="next">
					    <span class="glyphicon glyphicon-chevron-right"></span>
					  </a>
					
				</div>
			</div>
				
  		<?php endif; ?>
  		
  		<div class="contactDetails">
  			<h3><?php echo translate("detalii_furnizor"); ?></h3>
  			<ul>
		  		<?php if($city): ?>
			  		<li>
			  			<span><?php echo ucfirst(translate("city")); ?>:</span> <?php echo $city["name"]; ?>
		  			</li>
	  			<?php endif; ?>
	  			
	  			<?php if($county): ?>
			  		<li>
			  			<span><?php echo ucfirst(translate("county")); ?>:</span> <?php echo $county["name"]; ?>
		  			</li>
	  			<?php endif; ?>
		  		<li>
		  			<span><?php echo ucfirst(translate("business_type")); ?>:</span>
		  			<?php
		  				if($company["business_type"] == 1)
						{
							$businessType = translate("producator");
						}
						elseif($company["business_type"] == 2)
						{
							$businessType = translate("distribuitor");
						}
						elseif($company["business_type"] == 3)
						{
							$businessType = translate("furnizor");
						}
						
						echo ucfirst($businessType);
		  			?>
		  			 
	  			</li>
	  			
	  			<li><a href="#company_details" data-toggle="tab" class="details" title=""><?php echo translate("see_company_details"); ?></a></li>
	  			<li><a href="#feedback" data-toggle="tab" title="" class="contactNow"><?php echo translate("contacteaza_furnizor"); ?></a></li>
	  			<li>
		  			<span><?php echo ucfirst(translate("showroom_online")); ?>:</span> 
		  			<a href="<?php echo $site_pages["companies"]["url"] . $company["url"]; ?>.html" title="<?php echo $company["name"]; ?>"><?php echo $company["num_rows"]." ".translate("products"); ?></a>
	  			</li>
	  			<li><a href="<?php echo $site_pages["companies"]["url"] . $company["url"]; ?>.html" title="<?php echo $company["name"]; ?>"><?php echo translate("view_company_products"); ?></a></li>
		  	</ul>
		  	
  		</div>
		<?php
			$relatedProducts = getRecommendedProducts($page);
			
			if($relatedProducts):
		?>
			<div class="recommendedProducts">
				<h3><?php echo translate("related_products"); ?></h3>
				<div class="productHolder cols-1">
					<?php foreach($relatedProducts as $product): ?>
						<div class="product">
							<a class="productImage" href="<?php echo $product["url"]?>" title="<?php echo $product["name"]?>">
								<img src="<?php echo site_url().$product["images"][0]["thumb_name"]; ?>" alt="" class="img-responsive" />
							</a>
							<div class="productDetails">
								<a href="<?php echo $product["url"]; ?>" title="<?php echo $product["name"]; ?>"><?php echo $product["name"]; ?></a>
								<?php
									$summary = summarize_description($product["description"], 50);
									echo "<p>".$summary."</p>";
								?>
								<div class="productPrice">
									<?php echo $product["price"]; ?>
								</div>
							</div>
							
						</div>
						<div class="clearfix"></div>
					<?php endforeach; ?>
				</div>
			
			
			</div>
		<?php endif; ?>
	</div>
</div> <!--END SIDEBAR -->